package com.jch.dm.chapter_15_facade.pagemaker;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 * @author: Administrator
 * 获取指定数据库
 * @create: 2020/04/05 15:25
 **/
public class Database {
    /**
     * 防止外部new出Database的示例
     * 声明为private
     */
    private Database(){}
    /**
     * 根据数据库名获取Properties
     */
    public static Properties getProperties(String dbname){
        String filename = "src/main/java/com/jch/dm/chapter_15_facade/"+dbname + ".txt";
        Properties prop = new Properties();
        try {
            prop.load(new FileInputStream(filename));
        } catch (IOException e) {
            System.out.println("Warning："+filename+" is not found.");
        }
        return prop;
    }
}
